package com.lyl.activiti.demo.listener;

import java.net.ServerSocket;
import java.net.Socket;

import org.activiti.engine.delegate.BpmnError;
import org.activiti.engine.delegate.DelegateExecution;
import org.activiti.engine.delegate.JavaDelegate;

public class CheckServerDelegate implements JavaDelegate {

	public void execute(DelegateExecution execution) throws Exception {

		try {
			System.out.println("开始检查8080端口");
			ServerSocket serverSocket=new ServerSocket(8080);
			Socket socket = new Socket("127.0.0.1", 8080);
			System.out.println("检查8080端口完成");
		} catch (Exception e) {
			System.out.println("检查时出现异常，抛出错误");
			throw new BpmnError("error");
		}
	}

}
